package edu.maimonides.ejercicios.ides2.connection.factory.hsql;

import java.sql.Connection;
import java.sql.DriverManager;

import edu.maimonides.ejercicios.ides2.connection.factory.ConnectionFactory;

public class HSQLConnectionFactory implements ConnectionFactory {

	private static final String HSQL_DRIVER = "org.hsqldb.jdbc.JDBCDriver";

	private String username;
	private String password;
	private String url;
	
	public HSQLConnectionFactory( String url,String username,String password) {
		super();
		this.username = username;
		this.password = password;
		this.url = url;
	}

	public Connection createConnection() throws Exception {
		Class.forName(HSQL_DRIVER);
		Connection c = DriverManager.getConnection(this.getUrl(),this.getUsername(),this.getPassword());
		return c;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

}
